Transition from Deflagration to Detonation in Granular Explosives