Dynamics of two dipole-coupled superconducting qubits interacting with two independent cavity modes