  BEC of exciton-polaritons and related effects such as superfluidity1,2,
spontaneous symmetry breaking3,4 and quantised vortices5,6 open way to creation
of novel light sources7 and optical logic elements8. Remarkable observations of
exciton-polariton BEC in microcavities9-12 have been reported in the recent ten
years. Very recently, thermalisation and subsequent condensation of cavity
photons in a dye-filled microcavity have been observed13. Here we show that BEC
of both exciton-polaritons and photons can be created in the same system under
different optical excitation conditions. A dynamic phase transition between a
photon and a polariton BEC takes place after a single high-power excitation
pulse and we find both condensed states in thermal equilibrium with the excited
states. At the crossover, photons and polaritons coexist, which results in a
decrease in the long-range spatial coherence. Build-up and successive depinning
of polarisation is observed at the threshold of both polariton and photon
condensation.
