Observational constraints on a unified dark matter and dark energy model based on generalized Chaplygin gas