Gamma-ray bursts generated from phase transition of neutron stars to quark stars