Metamaterial perfect absorbers in the terahertz band are attracting more and more attention. Pure narrowband absorbers as well as broadband absorbers have been proposed one after another in recent years. However, absorbers that can achieve both narrow-band absorption and broadband absorption have hardly been reported. To meet more practical needs, we propose a terahertz metamaterial perfect absorber that combines ultra-broadband and narrowband based on the phase transition properties of vanadium dioxide (VO2). Its main structure consists of a metal ring and four VO2 discs, and the absorber can be flexibly switched between ultra-broadband and narrowband absorption by adjusting the ambient temperature. The resonator consisting of metal rings and VO2 discs are mainly responsible for the formation of absorption peaks. A detailed explanation is given by means of magnetic resonance theory and the impedance matching principle. Compared to recent reports, our design offers a significant improvement in absorption rate and bandwidth and is also flexible in terms of tuning. Moreover, as the phase transition temperature of VO2 is only slightly higher than room temperature, there are almost no limitations for experimental and practical applications. Therefore, our design will have significant applications in modulation, sensing, energy harvesting, switching devices, etc.