Electron-vibration interaction in single-molecule junctions: from contact to tunneling regime