Generic mechanism for generating a liquid-liquid phase transition