You have to be careful when doing this, due to some edge cases:
From the C++11 standard (§7.2,6):
For an enumeration whose underlying type is not fixed, the underlying
type is an integral type that can represent all the enumerator values
defined in the enumeration. If no integral type can represent all the
enumerator values, the enumeration is ill-formed. It is
implementation-defined which integral type is used as the underlying
type except that the underlying type shall not be larger than int
unless the value of an enumerator cannot fit in an int or unsigned
int.
This means that it is possible that an enum is a larger type than an int so the conversion from enum to int could fail with undefined results.
Subject to the above, it is possible to convert an int to an enum that results in an enumerator value that the enum does not specify explicitly. Informally, you can think of an enum as being an integral type with a few values explicitly defined with labels.