Reducing Blackwell and Average Optimality to Discounted MDPs via the Blackwell Discount Factor