Either way is fine. If you exercise right after, it might be uncomfortable. Two hours is fine, though, and if you eat a high-fat meal, exercise after if beneficial. Before is fine. Again, right before is likely to decrease your appetite immediately, but a couple of hours before should be fine. So, go with your preference.