Quadratic algebras and dynamics in curved spaces. II. The Kepler problem