Quantitative Differences : DNA and Gene
I interpret your question as: Given a stretch of DNA sequence, can we determine if it encodes a gene? My summary of the answer would be: "Sometimes".

The problem you ask about is called "Gene prediction" and is described in some detail by Wikipedia:  http://en.wikipedia.org/wiki/Gene_prediction

The most basic indication that a gene may exist is the presence of an "Open Reading Frame" (ORF). An ORF is a stretch of DNA from which a single protein may be produced.  However, an ORF is not strictly required for a gene (as not all genes encode proteins), and not all ORFs are genes. There are many software tools for gene prediction available which use different rules to predict if a given region of DNA is functional (contains a gene or a regulatory element). They may be usable on any kind of DNA sequence, or on sequences from certain organisms only, depending on the program.

Two commmonly used gene prediction tool are GLIMMER (http://www.ncbi.nlm.nih.gov/genomes/MICROBES/glimmer_3.cgi, used for microbial genomes) and GeneMark (http://opal.biology.gatech.edu/gmhmm2_prok.cgi). See also http://en.wikipedia.org/wiki/Gene_prediction

As a quick check, you may also use NCBI BLAST (http://blast.ncbi.nlm.nih.gov/Blast.cgi) to see if your sequence aligns to a known gene.