We propose a weighted-density connected dominating set (wDCDS) based data gathering algorithm for wireless sensor networks. The wDCDS is constructed using the weighted-density of a sensor node, which is defined as the product of the number of neighbors available for the node and the fraction of the initially supplied energy available for the node. A data gathering tree (wDCDS-DG tree) rooted at the wDCDS Leader (the node with the largest available energy) is formed by considering only the nodes in the wDCDS as the intermediate nodes of the tree. The leader node forwards the aggregated data packet to the sink. The wDCDS and wDCDS-DG tree are dynamically reconstructed for each round of data gathering. Simulation studies reveal that the wDCDS-DG tree yields a significantly larger network lifetime, lower delay and lower energy consumption per round compared to the density-only CDS and energy-only CDS based data gathering trees.