The game you're picturing is likely Demon Sword or Legend of the Mystical Ninja-style titles—but the closest match is a Taito release.
Both Demon Sword and Legend of Kage were made by the same company, Taito, and feature a ninja leaping between trees to battle foes, which fits your description perfectly.