I often find this affirmation when scientifics reffer to black holes: "A black hole is so dense that even light cannot escape from it" Does this mean that there is a relationship between density and gravity? For example, in the case of a black hole, why is it that its force of gravity is a lot more important than when it was a star (in the case of a star exploding and collapsing into its own weight to form a black hole) although the mass of this black hole and the mass of the star that formed it should be the same but in a different volume ?
Really gravity is causally dependent on the amount of matter(in fact energy) not in its density. There is a minimum density for a black hole but it is constant only for a defined amount of mass.
As objects of the nature of black holes are close to spherical instead of density it is more sensible to quantify a threshold radius, known as the Schwarzchild Radius.
The density of black holes makes an interesting quote because it is so extreme, but this effect can still be achieved with a quote like the Schwarzchild Radius of the earth is 9mm.
The amount of curvature of space-time (aka the strength of gravity) is related to the amount of energy in the space (this is both rest mass energy, kinetic energy and indeed energy in the electric field, vacuum energy$^1$, etc.)
At a point $r_p$ inside a homogeneous spherical body the effects of gravity due to all the energy in the body at $r>r_p$ can be neglected - they cancels out. Gravity is weaker inside a star (although there is a lot of weight of matter bearing down). In the centre of the star there is no net gravitational force.
Consequently a large body like your star doesn't at any radius achieve the gravitational strength necessary to create an event horizon. In fact for a given Mass the required radius that the matter must be contained in is the Schwarzchild Radius. For the sun, about 3km.
It's important to get all the mass below you so that it acts to increase gravity enough to cause an event horizon.
There is a relation between achieving the Schwarzchild Radius and a particular threshold density, but that density could also be achieved with a smaller mass and there would be no black hole.
This means for a particular mass there is a threshold density to achieve a black hole, if the mass and density are fixed and the object is spherical, which it will be under this kind of gravity, then the radius is known.
 This may be one of physics currently unsolved problems, as there may be a huge anomoly here - see "https://en.wikipedia.org/wiki/Cosmological_constant_problem"