Burning of a hadronic star into a quark or a hybrid star