In this paper, we study the problem of constructing an energy efficient data aggregation tree for data gathering in wireless sensor networks. We consider a real-time scenario where the data aggregation must be performed within a specified latency constraint. The objective is to minimize the overall energy cost of the sensor nodes in the aggregation tree subject to the latency constraint. We propose an algorithm that can construct a data aggregation tree with theoretically bounded energy cost under the latency constraint. Extensive simulations show that the proposed algorithm is very efficient in energy-saving under the latency constraint and has better performance than other existing algorithms.