Polarization-controlled spin reorientation transition and resistive switching in ferromagnetic-ferroelectric nanostructures and tunnel junctions