Can the same machine word sometimes be data and sometimes be code?
If your question is "can one and the same sequence of bits sometimes represent a machine instruction and sometimes represent data" then the answer is definitely yes.

If your question is "can one and the same location in memory sometimes hold a machine instruction and sometimes hold data" then the answer is it depends on the machine architecture. The Harvard architecture strictly segregates instruction memory and data memory into physically separate parts of the computer memory, with separate data buses. However, the Von Neumann has a single common memory which can hold either instructions or data at any location.

If your question is "can one and the same location in memory be treated sometimes as an instruction and sometimes as data by one and the same program" then the answer in a Von Neumann architecture is yes, in principle. However, this leads to the possibility of writing self-modifying code, which is considered undesirable because such code is difficult to maintain and is a security risk. Therefore all modern operating systems make sure that the programs they are running have a strict segregation between data and instructions, and cannot modify their own code. This is usually implemented within the operating system itself rather than at the physcial memory level.

Note, however, that the distinction between data and code still depends on context - what is data to one program may be code for another program. For example, the output of an assembler, which the assembler treats as data, will be treated as machine instructions when the assembled program is actually being run.