Preparation of hydrocarbons from hydrocarbons containing the same number of carbon atoms by dehydrogenation with formation of free hydrogen