If gravity accelerates all objects the same, why does a ball in water sink? I recently learned the law of universal gravitation: F = GmM / d². It dictates that all objects should fall at the same acceleration.
But how is density explained then? Take for example a watercontainer with a ball inside denser than water. However, the mass of the water is the same as the mass of the ball. 
So, if gravity pulls the water and the ball with the same force, how come the ball sink?
 A: I think what you're asking about is the question of buoyant forces upon the ball in the water, and so whether or not that, because while gravity accelerates all objects equally, a more dense ball in water would, under ordinary conditions, "want" more strongly to adhere to the bottom than a less-dense ball would, would this somehow change or cause the two to behave differently in free-fall?
And the answer to this is no. In free-fall, everything acts as if there were no gravity present, with regard to at least the local environment of the thing itself. This is a crucial insight that was what led Einstein to develop his theory of general relativity.(*) When there is no gravity, there are no buoyant forces. Thus the situations of separated ball-and-liquid pairs, separated balls, separated liquids, two balls of different densities immersed in same liquid, etc. all behave the same way in terms of downward motion. The balls and liquid fall at the same rate. Moreover, since the buoyant and all forces on the liquid in its reference frame are effectively zero, the liquid will try to round itself out - this is part of why that rain drops are roughly spherical (the elongation is due to aerodynamic forces due to the movement through the atmosphere - but if you isolated one drop in a small container with steady atmosphere to maintain pressure so as to remain liquid, it would assume a perfectly spherical shape in free-fall) - while the ball can assume and keep any position within or without the liquid, for the total duration of the fall until, of course, everything strikes the ground.
(*) In particular, what this tells you is free-fall is an inertial frame of reference in the exact same sense as Newton's first law, and by extension, that gravitational forces are "fictitious" forces like the centrifugal force! And this is a profound insight indeed, and its consequences at once both both wondrous and mind-boggling, and which have still yet to be entirely unraveled, even 100+ years later.
A: From a comment:

I'm thinking about a container of water and a ball inside it that is denser than water. So, if gravity pulls the water and the ball with the same force, how come the ball sink?

You have to realize that in the case of a dense ball in a container of water, both the water and the ball have other forces acting on them than just gravity. The ball has gravity and a buoyant force acting on it. The water has gravity and forces from the sides and bottom of the container acting on it.
When we say that all objects have the same acceleration due to gravity, this is assuming that gravity is the only force acting on the objects. As soon as other forces are involved, then you can make the accelerations anything you want them to be by picking the forces.
So, in your example the water is not accelerating because the force of gravity is exactly balanced out by the force from the bottom of the container acting on the water. The dense ball will accelerate down through the water, but with a reduced acceleration due to the buoyant force. This is because the buoyant force is weaker than the weight of the object.
A: In the situation where you have a ball inside, let's say, a water tank, and the water tank on top of a table, both the water and the ball feel the attraction of gravity. The water can't move down is because it's placed inside a rigid container on top of a table. But the ball is not inside a rigid medium; it is inside water. Therefore, if the gravitational pull is larger than the buoyancy force (which happens if the ball is denser than water, Archimedes' law), there is an acceleration pointing down that makes the ball sink.
If you throw from the top of a building a water tank with a ball inside, the ball wouldn't sink inside the water. Rather, the water and the ball would accelerate equally and not move with respect to each other.
A: Edit after comments by OP and clarification of question
A feather and a ball fall at the same rate in vacuum, because there is no air resistance.
As far as we have discovered by observations and the models fitted to observations, there are four forces in nature.
Matter as we have studied it  is composed out of atoms and molecules that are held together by electromagnetic interactions. Gravitational forces are very weak at the atomic level and do not contribute to the particular densities of particular masses, after they have formed. The density  depends on the organization of the electromagnetic interactions between the atoms. Thus some substances are dense, i.e. more atoms per cubic centimeters, and some lighter.
(this said, gravity collectively organizes matter, as in geological stratifications, and sediments in general, but once formed they are held together by electromagnetic interactions)
Thus, as gravitational forces always act and masses used in gravitation are posited to be the same masses in F=ma of accelerating objects, the combination of the gravitational force and the electromagnetic interactions of all atoms in any form lead to the observed buoyancy:

In physics, buoyancy or upthrust, is an upward force exerted by a fluid that opposes the weight of an immersed object. In a column of fluid, pressure increases with depth as a result of the weight of the overlying fluid. Thus the pressure at the bottom of a column of fluid is greater than at the top of the column. Similarly, the pressure at the bottom of an object submerged in a fluid is greater than at the top of the object. The pressure difference results in a net upward force on the object. The magnitude of the force is proportional to the pressure difference, and (as explained by Archimedes' principle) is equivalent to the weight of the fluid that would otherwise occupy the volume of the object, i.e. the displaced fluid.
For this reason, an object whose average density is greater than that of the fluid in which it is submerged tends to sink. If the object is less dense than the liquid, the force can keep the object afloat. This can occur only in a non-inertial reference frame, which either has a gravitational field or is accelerating due to a force other than gravity defining a "downward" direction.

(Air is considered a fluid in physics .)
In the situation of a ball withing a water container , the center of mass of the system will be falling with the gravitational force, and the system would not change during the fall (although waves might start with the initial acceleration in the water, the buoyancy would be the same)
A: Let's think of a deep bucket of water hanging from a wire hooked to a spring scale and a ball of steel suspended in the mid height of the bucket by another wire attached to another scale. Both suspended high and for clarity ignore the air friction.
The scale attached to the steel ball will show the weight of the ball minus weight of water it displaces.
The scale attached to the bucket will show weight of empty bucket plus the water and the weight of displaced water by the ball, but it won't see the steel ball.
Now we cut the wires in three scenarios.
A - both wires at the same time: the bucket of water and the ball start a free fall and the steel ball remains suspended in the same height of the water, because there is no buoyancy in the absence of hydrostatic pressure which is only because of resistance from the bottom of the bucket when it doesn't fall.
B - the bucket is released first and the ball is released just a bit later. The bucket will have picked a small initial speed first and the steel ball will lag behind increasingly more as time goes on and will eventually leave the water, leaving behind a depression in the water that would not rush back in with the water filling the hole.
C - the steel ball is released just a bit before the bucket is released. Then the ball and bucket will fall, but the ball will sink slightly more and hit the bottom of the bucket and likely will slowly bounce back up, if the bucket is flexible enough, while the collision will add a little more downward acceleration to the bucket trying to separate it from the water. And again the ball will emerge from the water up, provided the height of the fall is enough.
In all the above cases we have ignored the small turbulences in the water caused by the ball, we assume it moves slowly $ V_{Ball- Bucket} = \Delta t * g \ and\ \Delta \ t = very\ small.$
