Crossover from photon to exciton-polariton lasing