Changing Windows Editions

When installing Windows, the required features, technical requirements and roles needed will define which edition to choose, much like deciding which SQL Server instance type to install.

There are significant licensing costs between Standard and Datacenter. Since Windows Server 2016 and onwards, there are minor differences in roles and features between editions. 
It's important to ascertain your requirements before deciding on a specific edition to install. However, there could be a need to change editions for unforeseen circumstances.

One reason could be the need to host more than two Windows guests under Hyper-V, which is one primary limitation to using Standard. Hosting more than two Windows guests would require each additional guest to have their own license.
You can host an unlimited number of Windows VM guests on Datacenter, though the cost of the license is based on the number of processors and cores of that physical server.
Hyper-V Server on the other hand is free, but each Windows VM will require its own license, unless you are hosting Unix-like OS’, in which case it’s entirely free.

Depending on the media you have installed with, Microsoft Windows can typically be upgraded from Standard to Datacenter. I mention this because provisioning a Windows Server in Azure, there is no option to select Windows Server Standard, only Datacenter.

In this example, we first confirm the edition we have installed:

DISM /online /Get-CurrentEdition

Now we will confirm which other editions we can upgrade to:

DISM /online /Get-TargetEditions

Finally we will change from Windows Server 2016 Standard to Datacenter:

DISM /online /Set-Edition:ServerDatacenter /ProductKey:CB7KF-BWN84-R7R2Y-793K2-8XDDG /AcceptEula

Use the required KMS key for the desired version and edition you want to upgrade to. Refer to Microsoft's client setup keys page for a complete list of KMS keys.

Important: Changing editions will take several minutes to up to an hour or longer. While the server will still be accessible, treat this task as if it was installing patches and schedule an outage as a restart is required to complete the process.

While you can upgrade to a higher edition, ie: Standard to Datacenter, you can't officially downgrade without attempting an unsupported registry hack; essentially tricking Windows it's another earlier version and edition and performing an in-place upgrade to Standard.