Homoclinic and heteroclinic transfer trajectories between Lyapunov orbits in the Sun-Earth and Earth-Moon systems