Sudden transition to spatiotemporal chaos in a nonlinear Klein–Gordon equation