Crossover from scale-free to spatial networks