Quantum phase transition and quench dynamics in the two-mode Rabi model