Sophocles was very true to his cultural identity in the writing of Oedipus Rex. He remained true to the conventions of tragedy and used the tragic flaw, in the case of Oedipus it was hubris (another concept specific to Sophocles' cultural identity), to guide the actions of the protagonist. In many ways, Oedipus is one of the defining Greek tragedies. It is so much a part of the culture of the time that we often use it today to illustrate typical literature of that period. Because of this, the cultural identity of the playwright is inseparable from the cultural identity of the play.
Hansberry also reveals her cultural identity in A Raisin in the Sun. The play is clearly written from the point of view of a black woman growing up in a time when being came with an even larger burden than it may currently. The race and gender issues addressed in the play place it in a very specific time period and illustrate circumstances that were particular to one racial (and cultural) group of people. The enotes "Overview" and "Historical Context" pages offer a really great insight into how the time period and life of Ms. Hansberry affected her writing.
Wow. Great question. So good, in fact, that we can only scratch the surface of the answers here. The most direct answer is that both plays show what the authors thought were important, how they thought important issues should be addressed, and what the conceptual frameworks of their worlds were. For example, Oedipus Rex is a play in which fate, specifically a fate that aligns with divine or supernatural aims, shapes human lives. Lives have specific patterns, and Oedipus is a tragedy because it fulfills one of the darker predictions.
By contrast, A Raisin in the Sun is set in a naturalistic world. There are evils here, but the are made by humans alone. The tragedy of this world is that the people in it do not have to act as they do. There are no gods punishing them or forcing them along specific tracks, but only racism and their own limits/the limits society forces on them.