Wireless-powered communication network (WPCN) is a key technology to power energy-limited massive devices, such as on-board wireless sensors in autonomous vehicles, for Internet-of-Things (IoT) applications. Conventional WPCNs rely only on dedicated downlink wireless power transfer (WPT), which is practically inefficient due to the significant energy loss in wireless signal propagation. Meanwhile, ambient energy harvesting is highly appealing as devices can scavenge energy from various existing energy sources (e.g., solar energy and cellular signals). Unfortunately, the randomness of the availability of these energy sources cannot guarantee stable communication services. Motivated by the above, we consider a generalized WPCN where the devices can not only harvest energy from a dedicated multipleantenna power station (PS), but can also exploit stored energy stemming from ambient energy harvesting. Since the dedicated WPT consumes system resources, if the stored energy is sufficient, WPT may not be needed to maximize the weighted sum rate (WSR). To analytically characterize this phenomenon, we derive the condition for WPT activation and reveal how it is affected by the different system parameters. Subsequently, we further derive the optimal resource allocation policy for the cases that WPT is activated and deactivated, respectively. In particular, it is found that when WPT is activated, the optimal energy beamforming at the PS does not depend on the devices' stored energy, which is shown to lead to a new unfairness issue. Simulation results verify our theoretical findings and demonstrate the effectiveness of the proposed optimal resource allocation.Index Terms-Energy-constrained IoT networks, when to activate WPT, energy beamforming, optimal resource allocation.