Since the planets move in near circular orbits, constantly changing direction there must be (by the 2nd law) a force causing the circular motion and it's the gravitational force

so we have, for planetary motion GMm/r^{2} = mrω^{2} so you could say gravity "causes" centripetal force but I think it would be clearer to say in order for a planet to move in a circular orbit centripetal force is necessary and in the case of planets gravitational attraction provides the force.

When you swing a bucket of water in a vertical plane you provide the centripetal force that keeps the water in the bucket.

Hope this is clear

Jim