De-rating just operates the engine at a lower HP rating. For example, the PW123D engines on the Dash-8 produced I think something like 2150HP but were derated to something like 1990HP because it reduces the wear and tear. There is a ~100HP gap in between Max Rated Power and what is available to you in normal operation.
Flat-rating means that the engine will always produce X horsepower at the prop/shaft/whatever, but as you climb altitude the engine itself starts working harder to maintain this flat rating. You can consider it de-rated at sea level, and then it starts eating into that gap between normal power and max rated power as you climb in order to keep the power output the same. I actually think it is based on temperature rather than altitude but that is a good way to explain it.