Monte Carlo approach to phase transitions in quantum systems