Relation of the oscillator and Coulomb systems on spheres and pseudospheres